/*
 * Copyright (C) 31/05/2010 Aderbal Nunes <aderbalnunes@gmail.com>
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.boxandroid.myrom;

import android.graphics.Bitmap;

public class Graphics {

	public class Coordinates {
        private int _x = 0;
        private int _y = 0;

        public Coordinates(){
        }
        
        public Coordinates(int x, int y){
        	setX(x);
        	setY(y);
        }
        /**
         * @return The x coordinate of the upper left corner.
         */
        public int getX() {
            return _x;
        }

        /**
         * @return The x coordinate of the center.
         */
        public int getTouchedX() {
            return _x + _bitmap.getWidth() / 2;
        }

        /**
         * @param value The new x coordinate of the upper left corner.
         */
        public void setX(int value) {
            _x = value;
        }

        /**
         * @param value The new x coordinate of the center.
         */
        public void setTouchedX(int value) {
            _x = value - _bitmap.getWidth() / 2;
        }

        /**
         * @return The y coordinate of the upper left corner.
         */
        public int getY() {
            return _y;
        }

        /**
         * @return The y coordinate of the center.
         */
        public int getTouchedY() {
            return _y + _bitmap.getHeight() / 2;
        }

        /**
         * @param value The new y coordinate of the upper left corner.
         */
        public void setY(int value) {
            _y = value;
        }

        /**
         * @param value The new y coordinate of the center.
         */
        public void setTouchedY(int value) {
            _y = value - _bitmap.getHeight() / 2;
        }

        /**
         * Helper method for debugging.
         */
        public String toString() {
            return "Coordinates: (" + _x + "/" + _y + ")";
        }
    }
	
	// bitmap
	public Bitmap _bitmap;
	// cordinates
	public Coordinates _cordinates;
	// type
	public String _type;
	
	/**
	 * Constructor
	 * @param bitmap
	 */
	public Graphics(Bitmap bitmap){
		_bitmap = bitmap;
		_cordinates = new Coordinates();
	}
	
	/**
	 * Constructor
	 * @return Graphics
	 */
	public Graphics(){
		_cordinates = new Coordinates();
	}
	
	/**
	 * Constructor
	 * @return Graphics
	 */
	public Graphics(Coordinates coords){
		_cordinates = coords;
	}	
	
	/**
	 * Move to cordinates
	 * @param x
	 * @param y
	 */
	public void moveTo(int x, int y){
		get_cordinates().setX(x);
		get_cordinates().setY(y);
	}

	public Bitmap get_bitmap() {
		return _bitmap;
	}

	public void set_bitmap(Bitmap bitmap) {
		_bitmap = bitmap;
	}

	public Coordinates get_cordinates() {
		return _cordinates;
	}

	public void set_cordinates(Coordinates cordinates) {
		_cordinates = cordinates;
	}

	public String get_type() {
		return _type;
	}

	public void set_type(String type) {
		_type = type;
	}
	
}
